package me.keiwu.user.domain;

import lombok.Data;
import org.hibernate.annotations.ColumnDefault;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.Column;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;

/**
 * Created by kei on 27/10/2017.
 */
@Data
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class AbstractBaseEntity implements Serializable {

    @CreatedDate
    private Long createdTime;

    @LastModifiedDate
    private Long lastModifiedTime;

    @ColumnDefault(value = "0")
    @Column(nullable = false, columnDefinition = "TINYINT", length = 1)
    private boolean isDel;

}
